#include "./myEventManager.h"
#include "./myMacro.h"
#include "./myApplication.h"
#include "../adapter/skyTimer.h"
namespace Framework
{
	using namespace Sky;

	TResult myEventManager::dispatchSendEvent( Message* msg )
	{
		getApplication()->getWindowManager()->handleSendEvent(this,msg);
		return vSuccess;
	}
	
	myEventManager::myEventManager():m_CallBack(vNull),m_Timer(vNull)
	{
			
	}
	myEventManager::~myEventManager()
	{
			if(m_Timer)
			{
				delete m_Timer;
			}
	}
	
	Timer* myEventManager::getTimer()
	{
		if(m_Timer == vNull)
		{
			m_Timer = new Timer();
			m_Timer->CreateTimer(200000,Timer::TimerCallback(this,&myEventManager::handleTimer));
		}
		return m_Timer;
	}

	TBool myEventManager::getQueuedMessage(Message* event)
	{
		return(m_EventQueue.out(event));
	}

	TBool myEventManager::Create( myApplication* app )
	{
		m_app = app;
		return vTrue;
	}
}